import Axios from 'axios'
export default {
    install:function (Vue,option) {
        let instance = Axios.create({
            baseURL: "http://localhost:8888/api/private/v1/",
            timeout: 3000,
        });
        
        instance.interceptors.request.use(function (config) {
            let token = localStorage.getItem('token');
            if(token){
                config['headers']['Authorization'] = token
            }
            return config;
        }, function (error) {   
            // 对请求错误做些什么
            return Promise.reject(error);
        });
        Vue.prototype.$http = instance;
    }
}